/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.capex.farmacus.encapsulates;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author IK
 */
@Entity
@Table(name = "vendedores")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Vendedores.findAll", query = "SELECT v FROM Vendedores v"),
    @NamedQuery(name = "Vendedores.findById", query = "SELECT v FROM Vendedores v WHERE v.id = :id"),
    @NamedQuery(name = "Vendedores.findByNombre", query = "SELECT v FROM Vendedores v WHERE v.nombre = :nombre"),
    @NamedQuery(name = "Vendedores.findByTelefono", query = "SELECT v FROM Vendedores v WHERE v.telefono = :telefono"),
    @NamedQuery(name = "Vendedores.findByCedula", query = "SELECT v FROM Vendedores v WHERE v.cedula = :cedula"),
    @NamedQuery(name = "Vendedores.findBySupervisorVenta", query = "SELECT v FROM Vendedores v WHERE v.supervisorVenta = :supervisorVenta"),
    @NamedQuery(name = "Vendedores.findByCorreoVendedor", query = "SELECT v FROM Vendedores v WHERE v.correoVendedor = :correoVendedor")})
public class Vendedores implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Column(name = "nombre")
    private String nombre;
    @Column(name = "telefono")
    private String telefono;
    @Column(name = "cedula")
    private String cedula;
    @Basic(optional = false)
    @Column(name = "supervisor_venta")
    private int supervisorVenta;
    @Column(name = "correo_vendedor")
    private String correoVendedor;
    @JoinColumn(name = "id", referencedColumnName = "idsupervisores", insertable = false, updatable = false)
    @OneToOne(optional = false)
    private Supervisores supervisores;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "vendedores")
    private List<Vendedorfarmaciamedicamento> vendedorfarmaciamedicamentoList;
    @OneToMany(mappedBy = "idVendedor")
    private List<Autenticacion> autenticacionList;

    public Vendedores() {
    }

    public Vendedores(Integer id) {
        this.id = id;
    }

    public Vendedores(Integer id, int supervisorVenta) {
        this.id = id;
        this.supervisorVenta = supervisorVenta;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public String getTelefono() {
        return telefono;
    }

    public void setTelefono(String telefono) {
        this.telefono = telefono;
    }

    public String getCedula() {
        return cedula;
    }

    public void setCedula(String cedula) {
        this.cedula = cedula;
    }

    public int getSupervisorVenta() {
        return supervisorVenta;
    }

    public void setSupervisorVenta(int supervisorVenta) {
        this.supervisorVenta = supervisorVenta;
    }

    public String getCorreoVendedor() {
        return correoVendedor;
    }

    public void setCorreoVendedor(String correoVendedor) {
        this.correoVendedor = correoVendedor;
    }

    public Supervisores getSupervisores() {
        return supervisores;
    }

    public void setSupervisores(Supervisores supervisores) {
        this.supervisores = supervisores;
    }

    @XmlTransient
    public List<Vendedorfarmaciamedicamento> getVendedorfarmaciamedicamentoList() {
        return vendedorfarmaciamedicamentoList;
    }

    public void setVendedorfarmaciamedicamentoList(List<Vendedorfarmaciamedicamento> vendedorfarmaciamedicamentoList) {
        this.vendedorfarmaciamedicamentoList = vendedorfarmaciamedicamentoList;
    }

    @XmlTransient
    public List<Autenticacion> getAutenticacionList() {
        return autenticacionList;
    }

    public void setAutenticacionList(List<Autenticacion> autenticacionList) {
        this.autenticacionList = autenticacionList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Vendedores)) {
            return false;
        }
        Vendedores other = (Vendedores) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "edu.capex.farmacus.encapsulates.Vendedores[ id=" + id + " ]";
    }
    
}
